package pack1;

import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;

/**
 * Created by jack on 2017/7/3.
 * 注解方式：利用JSR-250的@PostConstruct和@PreDestroy
 */
public class JSR250WayService {
    //在构造函数执行完之后执行
    @PostConstruct //1
    public void init()
    {
        System.out.println("jsr250-init-method");
    }

    public JSR250WayService()
    {
        super();
        System.out.println("初始化构造函数-JSR250WayService");
    }

    //在Bean销毁之前执行。
    @PreDestroy //2
    public void destroy()
    {
        System.out.println("jsr250-destory-method");
    }
}
